<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang=en>
<head>
<title>test</title>
<meta http-equiv=content-type content="text/html; charset=iso-8859-1" >
<script type="text/javascript" src="RSA.js"></script>
<script type="text/javascript" src="BigInt.js"></script>
<script type="text/javascript" src="Barrett.js"></script>
<script type="text/javascript">
	<!--
	var key;
	function evalPrompt() {
	
			setMaxDigits(131);
		key2 = new RSAKeyPair(
		 "7753edb9acfde9c8594975e1262d85a57741b4442357bdd50ad2880dbb04a97ecb1ad3ade4ebd62b0ecd27d9cfbcf4712bf6a2693ae998db3c00c0aa9480d0630310e67b9ad1496fbbec58f8421ad06087cb6d159e6be093420aaa82915c08db77dca28bfba7e45144233a7633476743cf2b2a817cdb3fdf325870e349620a9",
		 "c5f889337302a79d2dc4f95564be36c78ed6a16574b18cb31858f18b4cbc4fe43137b2dc30377c6538f040798c1aea6477fba31f4e6726dbc3718b14d292e7dec02040bb34fe0cd5b11e8673398c4244ed14abff3707fec0f44c8f41689893b693ad2c75e3737bdbd390c6bcf067f3bc57da40706b5d31ec16617a3fffda89",
		 "89bd9f24cc4e1a459ea37b59648804b50b37d87a23a803e3ef9db5cc2ee74f4ccd5fef7243252dce168f145165f34eb63c26d3e7b4e5358de892e90e3811c1878d7ec0d964b475942b96e9c97f5b396a3d60c89e09390b3b8bcf579a4ba011b60a3c5a62328f98fb4ce799c554abc1a554863fc8da269388beaa5da03edd30b"
		);

		var toEval = prompt('Enter the keys','keys');
		key = eval(toEval);
		//alert(key.chunkSize);
		//alert(key.radix);
		//alert(key.barrett);
		
		var encrypted = encryptedString(key, "Hello World");
		alert('encrypted: ' + encrypted);
		
		var encrypted2 = encryptedString(key2, encrypted);
		alert('2x encrypted: ' + encrypted2);
		
		var decrypted1 = decryptedString(key2, encrypted2);
		alert('decrypted1	: ' + decrypted1);
		
		var decrypted2 = decryptedString(key, decrypted1);
		alert('decrypted2: ' + decrypted2);

	}

	function evalPrompt2() {
	
		setMaxDigits(131);
		key = new RSAKeyPair(
		 "7753edb9acfde9c8594975e1262d85a57741b4442357bdd50ad2880dbb04a97ecb1ad3ade4ebd62b0ecd27d9cfbcf4712bf6a2693ae998db3c00c0aa9480d0630310e67b9ad1496fbbec58f8421ad06087cb6d159e6be093420aaa82915c08db77dca28bfba7e45144233a7633476743cf2b2a817cdb3fdf325870e349620a9",
		 "c5f889337302a79d2dc4f95564be36c78ed6a16574b18cb31858f18b4cbc4fe43137b2dc30377c6538f040798c1aea6477fba31f4e6726dbc3718b14d292e7dec02040bb34fe0cd5b11e8673398c4244ed14abff3707fec0f44c8f41689893b693ad2c75e3737bdbd390c6bcf067f3bc57da40706b5d31ec16617a3fffda89",
		 "89bd9f24cc4e1a459ea37b59648804b50b37d87a23a803e3ef9db5cc2ee74f4ccd5fef7243252dce168f145165f34eb63c26d3e7b4e5358de892e90e3811c1878d7ec0d964b475942b96e9c97f5b396a3d60c89e09390b3b8bcf579a4ba011b60a3c5a62328f98fb4ce799c554abc1a554863fc8da269388beaa5da03edd30b"
		);
		
		var encrypted = encryptedString(key, "Hello World");
		alert('encrypted: ' + encrypted);
				
		var decrypted = decryptedString(key, encrypted);
		alert('decrypted: ' + decrypted);

	}

	
	function evalPrompt3() {
		alert('1');
		key = new RSAKeyPair(
		 "26a5b0dfdd2247d72d5e3a4517b09c2b",
		 "17b9ef79cba5af998ceafbbc0e671953",
		 "f186522a984ad69bb701219f92b9fec1"
		);
		alert('2');
		//alert(key.e + key.d + key.m);
		alert(key.chunkSize);
		alert(key.radix);
		alert(key.barrett);
		
	}

	function evalPrompt4() {
		key = new RSAKeyPair(
		 "26a5b0dfdd2247d72d5e3a4517b09c2b",
		 "0",
		 "f186522a984ad69bb701219f92b9fec1"
		);
		//alert(key.e + key.d + key.m);
		alert(key.chunkSize);
		alert(key.radix);
		alert(key.barrett);
		
	}
	//-->
</script>
</head>

<body>
<button type="button" onClick='evalPrompt()'>Eval!</button>
<br/>
<button type="button" onClick='evalPrompt2()'>Translate/Untranslate</button>
<br/>
<button type="button" onClick='alert( (biFromHex(5)).digits )'>biFromHex!</button>
<br/>
<button type="button" onClick='evalPrompt3()'>Eval3!</button>

<br/>
<button type="button" onClick='evalPrompt4()'>Eval4!</button>


</body>

</html>
